package com.ju.demo.service.impl;

import com.ju.demo.entity.FlowMsg;
import com.ju.demo.service.FlowMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

@Service
public class FlowMsgServiceImpl implements FlowMsgService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public FlowMsg findFlowMsgByTeamId(Integer id) {
        String teamId = id.toString();
        Query query = new Query(Criteria.where("currentTeamID").is(teamId));
        FlowMsg one = mongoTemplate.findOne(query, FlowMsg.class);

        return one;
    }
}
